﻿using System;
using System.Web.Mvc;
using AutoMapper;
using WebApp.ModelService;
using WebApp.Services;

namespace WebApp.Controllers
{
    public class AccountController : SmartController
    {

        private readonly IAccountModelService _accountModelService;
        public AccountController(IUserSession userSession, IMappingEngine mappingEngine, IAccountModelService accountModelService)
            : base(userSession, mappingEngine)
        {
            _accountModelService = accountModelService;
        }

        public ActionResult Index()
        {
            var response = _accountModelService.GetPageBySpecification();
            return View(response);
        }       

        public ActionResult Add()
        {
            var response = _accountModelService.GetAccountDetailById();
            return View(response);
        }

        [Authorize]
        public ViewResult Show(Guid id)
        {
            var response = _accountModelService.GetAccountDetailById(id);
            return View(response);
        }

        [Authorize]
        public ViewResult Edit(Guid id)
        {
            var response = _accountModelService.GetAccountDetailById(id);
            return View(response);
        }
    }
}
